package com.css.zfzx.fwsjcj.modules.expert.respository;

import com.css.bpm.platform.org.division.repository.entity.DivisionEntity;
import com.css.zfzx.fwsjcj.modules.expert.entity.FwExpertEntity;
import com.css.zfzx.fwsjcj.modules.expert.entity.FwUserDivisionEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Repository
public interface DivisionRespository extends JpaRepository<DivisionEntity,String> {


    @Query(nativeQuery = true,value = "select * from org_division where is_valid=1 and division_level <> '3' order by division_code")
    List<DivisionEntity> initZtree();

    @Query(nativeQuery = true,value = "select structure_type from fw_expert_direction where user_id=:userId")
    String getExpertStructureType(@Param("userId") String userId);

    @Query(nativeQuery = true,value = "select data_type dataType from fw_expert_direction where user_id=:userId")
    String getExpertDataType(@Param("userId")String userId);
}
